package com.lemon.soft.bookingroom.controller;

import java.util.Arrays;
import java.util.Map;


import com.lemon.soft.bookingroom.util.PageUtils;
import com.lemon.soft.bookingroom.util.R;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.lemon.soft.bookingroom.entity.RolesEntity;
import com.lemon.soft.bookingroom.service.RolesService;




/**
 * 
 *
 * @author ${author}
 * @email ${email}
 * @date 2025-05-29 12:38:52
 */
@Tag(name = "角色管理",description = "不用理会：用于增加角色，如管理员、客户")
@RestController
@RequestMapping("bookingroom/roles")
public class RolesController {
    @Autowired
    private RolesService rolesService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = rolesService.queryPage(params);

        return R.ok().put("page", page);
    }




    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody RolesEntity roles){
		rolesService.save(roles);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public R update(@RequestBody RolesEntity roles){
		rolesService.updateById(roles);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    public R delete(@RequestBody Integer[] roleIds){
		rolesService.removeByIds(Arrays.asList(roleIds));

        return R.ok();
    }

}
